package com.patternsbox.structural.composite;

abstract class Component {
	
	protected String name;

	// Constructor
	public Component(String name) {
		this.name = name;
	}

	public abstract void add(Component leaf);
	public abstract void remove(Component leaf);
	
	public void display(int depth){
		StringBuilder builder = new StringBuilder("-");
		
		for (int i = 0; i < depth; i++)
			builder.append("-");
		
		builder.append(name);
		
		System.out.println(builder.toString()+" and isComposite()="+isComposite());
	}
	//An operation
	public abstract boolean isComposite();
}
